import React, { Component, useReducer, useState, useMemo } from "react";
/* 
useMemo   :需要大量计算时 用到
作用：在组件每次重新渲染的时候，缓存计算的结果
*/
export default function UseRedu() {
  let [num, setNum] = useState(1);
  let useMe = useMemo(() => {
    return num + 6;
  }, [num]);
  return (
    <>
      <h3>useMemo的使用</h3>
      <p>useMemo:{useMe}</p>
      <button onClick={() => setNum(num + 1)}>++</button>
    </>
  );
}
